home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 34.zip / BS1 part 34 / Utilities.adf / AmigaMon.Doc.pp / AmigaMon.Doc
Text File  |  1988-01-20  |  15KB  |  395 lines

  1.  
  2.                  Amiga Monitor 1.07 instructions
  3.                  ===============================
  4.  
  5.   The monitor can be started both from CLI and from workbench. If you want
  6.   to start the monitor from workbench, you must first make an icon for it.
  7.   (starting the monitor from workbench is not recommended, because the
  8.   programs that are run under the control of the monitor may require the
  9.   CLI environment or else they may wait for workbench startup message
  10.   forever...)
  11.  
  12.  Input line editing and command line history:
  13.  --------------------------------------------
  14.   You can edit the input lines by using the left/right cursor keys to move
  15.   left and right, backspace to delete the character before the cursor and
  16.   del to delete the character under the cursor. You can use the up/down
  17.   cursor keys to get the old command lines (the monitor remembers 10 last
  18.   command lines). Shift-cursor-up gets the last command and enters it
  19.   automatically (you need not to press <CR>). In assembler mode you can
  20.   press Ctrl-E to edit the assembler instruction currently stored in that
  21.   address.
  22.  
  23.  Stopping the output:
  24.  --------------------
  25.   In most cases the output of the monitor can be suspended by pressing SPACE
  26.   and continued by pressing SPACE again. To permanently stop the output,
  27.   press Ctrl-C.
  28.  
  29.  Numbers:
  30.  --------
  31.   Hexadecimal numbers can include the '$'-prefix but it is not necessary
  32.   when the numbers are positive (or unsigned).
  33.   Negative hex numbers must include the '$'-prefix, for example -$12A3.
  34.   Positive decimal number must have the '+'-sign, for example +17051.
  35.   Numbers can also be represented as ASCII-strings with max. 4 characters,
  36.   for example 'HELP' is $48454C50 hex and 'PC' is $00005043 hex.
  37.   Note: It is necessary to include the '$' prefix to posivive hex numbers
  38.   beginning with 'A' or 'D' in some assembler instructions, because
  39.   otherwise they could be interpreted as register names.
  40.  
  41.  Strings:
  42.  --------
  43.   Strings are used in the fill command, the hunt command, the modify memory
  44.   command and the assembler directive dc.b .
  45.   Strings are series of bytes, represented by numbers or ASCII-characters
  46.   in single quotes or both together separated by commas.
  47.   Note: the single quote itself may be included in a quoted string if it
  48.   is duplicated.
  49.    examples:
  50.     'this is a string'
  51.     12,34,56
  52.     ''''  -- this means one single quote
  53.     'both',0A,'text',+10,'and','numbers'
  54.  
  55.  
  56. New features and bug fixes in version 1.07:
  57. -------------------------------------------
  58.  - The disassembler and assembler handle exg Dn,An correctly
  59.    (previously the data and address register numbers were reversed)
  60.  
  61.  - The disassembler no more displays any invalid codes as valid
  62.    instructions (On the 68000 processor, of course. The monitor does
  63.    currently not support 68010/68020 extra instructions).
  64.  
  65.  - The pc-relative indexed addressing mode now works with the assembler.
  66.  
  67.  - Some little bugs were fixed in the assembler.
  68.     + And/or-instructions work with a pc-relative source operand. 
  69.     + cmpm works with all sizes
  70.     + most(if not all...) of the bugs that caused the assembler to
  71.       assembler invalid instructions have been fixed.
  72.  
  73.  - 'sp' can be used instead of 'a7' in the assembler and the disassmbler
  74.    displays a7 as 'sp'.
  75.  
  76.  - The assembler now unserstands blo/bhs, slo/shs and dblo/sbhs
  77.    and assembles them as bcs/bcc, scs/scc and dbcs/dbcc
  78.  
  79.  - The disassembler displays address-register relative offsets and short
  80.    absolute addresses as signed numbers.
  81.  
  82.  - The monitor works now better with 60-column mode.
  83.  
  84.  - Disk read/write commands can be used with non-chip memory
  85.  
  86.  - Play digisound command has an optional parameter to specify
  87.    how many times the sample is played.
  88.  
  89.  - A new command has been added to specify a command line for programs
  90.    executed under the control of the monitor.
  91.  
  92.  - Breakpoints work even if you jump into the code at to breakpoint.
  93.    The breakpoint does not activate until the instruction at the break
  94.    position is executed, so you don't get immediately interrupted.
  95.    (internally the monitor uses the trace-exception to skip the breakpoint
  96.    at the first time...)
  97.  
  98.  
  99. Special Note:
  100. -------------
  101.  There is a problem with the walk (trace) command and several instructions
  102.  that cause processor exceptions. These instructions are chk, trap #n,
  103.  trapv and divu/divs (with divisions by zero). If you try to trace these
  104.  instructions, a trace-exception occurs in supervisor-mode, out of the
  105.  monitors control and you get a guru meditation alert with number 00000009.
  106.  This problem was with the earlier monitor versions as well. In the new
  107.  version it can also also occur if you jump to the code at a breakpoint
  108.  address, as the monitor internally traces over the breakpoint.
  109.  
  110.  Included with the monitor is a program called patchtrace that changes
  111.  directly the processor hardware trace-exception vector to point a new
  112.  routine that removes the trap-trace problem.
  113.  
  114.  
  115.  The following commands are available in the monitor:
  116.  ----------------------------------------------------
  117.  
  118. ? or the HELP key on the keyboard
  119.  displays a help screen.
  120.  
  121. i -- info
  122.  displays info-message
  123.  
  124. o -- redirect output
  125.  usage:
  126.   o name -- redirects monitor output to file or device 'name'
  127.   o      -- returns to normal, output comes to the monitor window
  128.  for example, to send the output to printer use 'o PRT:'.
  129.  
  130. m -- display memory in hex and ASCII
  131.  usage:
  132.   m                   -- display 20 lines from current address
  133.   m <addr>            -- display 20 lines from <addr>
  134.   m <addr> <end-addr> -- display from <addr> to <end-addr>
  135.  
  136. : -- modify memory
  137.  usage:
  138.   : <addr> <string>
  139.   puts the <string> in memory at <addr>
  140.   this can also be done with the command 'a <addr> dc.b <string>'
  141.  
  142. f -- fill memory with a byte or a string of bytes
  143.  usage:
  144.   f <start-addr> <end-addr> <byte>   ;fills with <byte>
  145.   f <start-addr> <end-addr> <string> ;fills with the string
  146.  example:
  147.   f 60000 601FF 4E,71 fills from $60000 to $601FF with NOP-instruction
  148.  
  149. t -- transfer (move) memory
  150.  usage:
  151.   t <start-addr> <end-addr> <destination-addr>
  152.  the command works correctly even if the source and destination memory
  153.  blocks overlap. (if destination is at a higher address than source,
  154.   the block is moved backwards, starting at the end)
  155.  
  156. h -- hunt (find) string in memory
  157.  usage:
  158.   h <start-addr> <end-addr> <string>
  159.   displays all addresses in the range <start-addr>..<end-addr>
  160.   where the <string> is found.
  161.  
  162. c -- compare memory
  163.  usage:
  164.   c <start-addr> <end-addr> <string>
  165.   displays all addresses in the range <start-addr>..<end-addr>
  166.   where is corresponding byte in the destination block is different from
  167.   the source.
  168.  
  169. a -- assemble
  170.  usage:
  171.   a         : assemble to the current address
  172.   a <addr>  : assemble to <addr>
  173.   a <addr> <instruction> : assemble <instruction> at <addr>
  174.   After assembling an instruction the monitor prompts with the address of
  175.   the location following the instruction just assembled and waits a new
  176.   instruction to be entered. To exit this mode, simply press <CR> without
  177.   entering an instruction. To edit an existing instruction, press Ctrl-E when
  178.   the monitor is waiting an assembler instruction.
  179.    The assembler understands all the normal 68000 instructions and also
  180.   the 'pseudo-instructions' dc.b, dc.w and dc.l, which can be used to
  181.   directly put data in memory.
  182.  
  183.  Some notes about using the assembler:
  184.  -------------------------------------
  185.    When entering assembler instructions which have an implicit size, no
  186.    size specifier is allowed in the monitor assembler. These instructions
  187.    are for example btst, bchg, bclr, btst, lea, move to/from sr/ccr/usp,
  188.    andi/ori/eori #data,sr/ccr Scc (set according to condition),
  189.    abcd/sbcd/nbcd and shifts with memory operands.
  190.  
  191.    Instructions that can have different sizes must have the size specifier,
  192.    there is no 'default size' (normal assemblers use a default size of word.
  193.    the omission of default size is intentional, because it is so easy to
  194.    forget the size specifier when you really don't mean the size to be word).
  195.  
  196.    Branch instructions with no size specifier or the .l-specifier assemble
  197.    to normal (16-bit offset) branches, if given the .s-size specifier they
  198.    assemble to the short form (8-bit offset). The dbxx-(decrement and branch)
  199.    -instructions allows no size specifier.
  200.  
  201.    The assembler converts add/sub/and/or/eor with immediate data source
  202.    automatically to adda/addi/subi/andi/eori. It does not convert move or
  203.    add/sub to the quick form nor does it convert branches automatically to
  204.    the short form. You must specify those yourself (so you must use the
  205.    moveq/addq/subq- instructions or specify the size .s to branches
  206.    as noted above). Also cmp-memory instruction must be entered as cmpm,
  207.    the assembler does not convert cmp (an)+,(an)+ to cmpm.
  208.  
  209.    The above conversion rules do not apply to andi/ori/eori with status
  210.    register or condition code register. In these cases you must enter the
  211.    instruction as andi/ori/eori (don't leave the 'i' out). Also, you
  212.    can't enter any size specifier in this case.
  213.  
  214.  
  215. d -- disassemble
  216.  usage:
  217.   d                   -- disassemble 20 lines from current address
  218.   d <addr>            -- disassemble 20 lines from <addr>
  219.   d <addr> <end-addr> -- disassemble from <addr> to <end-addr>
  220.  
  221. r -- show or change registers
  222.  usage:
  223.   r        -- displays all registers
  224.   r <reg>=<number> or
  225.   r <reg> <number> -- puts the value <number> into <reg>
  226.    examples:
  227.     r D0=0
  228.     r A5 $60000
  229.  
  230. b -- set breakpoints
  231.  usage:
  232.   b <addr> -- sets a breakpoint to <addr>
  233.    Breakpoints are implemented by putting an illegal opcode ($4AFC) in the
  234.   breakpoint locations when a G or J command is given. After returning to
  235.   the monitor the original contents of the breakpoints are restored. This
  236.   means that you can not put breakpoints to ROM (but you can trace ROM code).
  237.  
  238. br -- remove breakpoints
  239.  usage:
  240.   br <addr> -- removes the breakpoint at <addr>
  241.   br all    -- removes all breakpoints
  242.  
  243. bl -- list breakpoints
  244.  usage:
  245.   bl -- display a list of all breakpoints
  246.  
  247. g [addr] -- go (execute machine code)
  248.  
  249. j [addr] -- jump to subroutine
  250.  
  251. w [addr] -- walk (single step trace)
  252.  
  253.  the g, j and w-commands use the current program counter value
  254.  (displayed with the r-command) if you don't give them an address.
  255.  
  256. note: there is no easy way to run BCPL programs (CLI commands) or other
  257. programs that use the internal BCPL library from the monitor.
  258.  
  259. @ -- enter command line
  260.  usage:
  261.   @ [command line]. If you don't specify a command line (enter only @<cr>)
  262.   then the monitor will prompt for command line. the command line will
  263.   be put in a special memory area and the register a0 will contain pointer
  264.   to the string and d0 will contain length of the string (with a linefeed
  265.   appended to end of it).
  266.   The purpose of this command is to specify a command line for the program
  267.   that you are running from the monitor.
  268.  
  269. l -- load segment
  270.  usage:
  271.   l <name> -- loads the executable file <name> in memory and displays
  272.   the starting address of the first hunk, also sets PC to this address.
  273.   only one segment can be loaded at the same time. Before loading a new
  274.   segment you must unload the old segment with the u-command. To display
  275.   the starting & ending addresses of all the hunks in the file, use the
  276.   sl-command.
  277.  
  278. u -- unload segment
  279.  usage:
  280.   u  -- unload the current segments (frees the memory of that segment)
  281.  
  282. sl -- segment list
  283.  usage:
  284.   sl -- displays the starting & ending addresses and length of each hunk
  285.   of the currently loaded file.
  286.  
  287. n -- number base conversion
  288.  usage:
  289.   n <number>  -- displays the <number> in hex, decimal, octal and binary.
  290.   If the number is negative, displays it as signed and unsigned.
  291.  
  292. ( -- allocate memory
  293.  usage:
  294.   ( <length>        -- allocate <length> bytes any type of memory
  295.   ( <length> 'CHIP' -- allocate <length> bytes of chip memory
  296.   Displays the start & end addresses of the allocated memory block.
  297.  
  298. & -- allocate absolute memory location
  299.  usage:
  300.   & <addr> <length> -- allocate <length> bytes at <addr>
  301.  
  302. ) -- free memory
  303.  usage:
  304.   ) <addr> -- frees the memory block starting at <addr>
  305.   ) all    -- frees all the memory allocated with the (- and &-commands
  306.  
  307. sm -- show allocated memory
  308.  usage:
  309.   sm -- display all memory blocks allocated with the (- and &-commands
  310.  
  311. [  -- read file
  312.  usage:
  313.   [ <addr> <name> -- reads the file <name> to memory starting at <addr>
  314.  
  315. ]  -- write file
  316.  usage:
  317.   ] <addr> <length> <name> -- creates a file named <name> and writes <length>
  318.  bytes of memory starting at <addr> to the file.
  319.  
  320. <  -- read disk sectors
  321.  usage:
  322.   < <addr> <drive> <start-sector> <number-of-sectors>
  323.  Reads <number-of-sectors> sectors from the disk in unit <drive> to memory
  324.  starting at <addr>. <drive> is a number between 0..3,
  325.  corresponding the DOS devices DF0: -- DF3:
  326.  
  327.  In this version the read destination address
  328.  does not need to be in chip memory.
  329.  
  330. >  -- write disk sectors
  331.  usage:
  332.   > <addr> <drive> <start-sector> <number-of-sectors>
  333.  Writes <number-of-sectors> sectors to the disk in unit <drive> from memory
  334.  starting at <addr>. <drive> is a number between 0..3,
  335.  corresponding the DOS devices DF0: -- DF3:
  336.  
  337.  In this version the write source address
  338.  does not need to be in chip memory.
  339.  
  340. =  -- corrects a disk block checksum
  341.  usage:
  342.   = <addr> -- if there is a DOS-format disk block read into memory at <addr>,
  343.  calculates the correct checksum for the block and stores it in the block.
  344.  Displays old and new checksums. This command is useful if use use the
  345.  monitor as a disk editor.
  346.  
  347. #  -- corrects bootblock checksum
  348.  usage:
  349.   # <addr> -- if there is a disk bootblock (2 disk blocks, 1024 bytes) read
  350.  into memory at <addr>, calculates a new checksum for the bootblock and stores
  351.  it in the bootblock. Displays old and new checksums.
  352.  
  353. !  -- play digisound
  354.  usage:
  355.   ! <addr> <length> <period> [<count>]
  356.  Plays sound <length> bytes starting at <addr> and using sampling period
  357.  <period>. the sound repeats <count> times or until you stop it by
  358.  pressing Ctrl-C. <addr> must be in CHIP memory!.
  359.  
  360. cls -- clears the monitor window
  361.  
  362. del <filename> -- deletes a file
  363. cd  <dirname>  -- sets the current directory
  364.  
  365. dir [<name>]   -- displays the directory
  366.  
  367. \ -- new CLI
  368.   Opens a new CLI window. This CLI is a separate process, so you can continue
  369.   to use the monitor when the CLI window is there. Also the CLI window does
  370.   not close automatically when you exit the monitor. You must close it with
  371.   the CLI command EndCLI. In fact the monitor uses the NewCLI command
  372.   to open the new CLI window.
  373.  
  374. x -- exit
  375.  frees all memory allocated by the monitor, closes redirection file (if open)
  376.  and exits the monitor.
  377.  
  378.  
  379. version 1.07 of the monitor (and this document) by Timo Rossi  1989-08-28
  380.  
  381.  
  382.  
  383. * Note from John van Dijk (Who put this in Public Domain)
  384.  
  385.  I would like to thank Timo for hearing my critisism and removing the bugs
  386.  I found in a record time, it proves that feedback to the programmer can
  387.  be very helpful for both the user and the programmer to make a better
  388.  product. The reason why I like this monitor so much is it's size, the
  389.  complete multitasking (by using a seperate window) and the vast number
  390.  of handy options. Timo asked me to make sure that the PATCHTRACE program
  391.  was included too. And for installing ROSSIMON V1.07 on your disk is a
  392.  ZOO file also available.                Have 'fun' with your debugging.
  393.  
  394.  
  395.